<?php
/**
 * 题库管理模块
 * @author ChunYang.Jiang<chunyang@staff.sina.com.cn>
 * @version $Id$
 * @copyright sina
 * @date 2011-04-14
 */
class Subject extends Controller
{
	protected $_allowtype = array(
		'single','multi','fill','qa','assem','separator','customize'
	);
	protected $surveyid = 0;
	public function __construct()
	{
		parent::__construct();
		$surveyid = isset($_GET['surveyid']) && $_GET['surveyid'] ? intval($_GET['surveyid']) : Util::msgRedirect('缺少问卷ID');
		if (!SurveyModule::getSurveyById($surveyid)){
			Util::msgRedirect('问卷不存在');
		}
		$this->surveyid = $surveyid;
		$tabs = array(
			array(
				'name'	=> '单选题',
				'url'	=> "/Admin/Subject/Add/surveyid/{$surveyid}/type/single",
			),
			array(
				'name'	=> '多选题',
				'url'	=> "/Admin/Subject/Add/surveyid/{$surveyid}/type/multi",
			),
			array(
				'name'	=> '填空题',
				'url'	=> "/Admin/Subject/Add/surveyid/{$surveyid}/type/fill",
			),
			array(
				'name'	=> '问答题',
				'url'	=> "/Admin/Subject/Add/surveyid/{$surveyid}/type/qa",
			),
			array(
				'name'	=> '组合选择题',
				'url'	=> "/Admin/Subject/Add/surveyid/{$surveyid}/type/assem",
			),
			array(
				'name'	=> '分隔符',
				'url'	=> "/Admin/Subject/Add/surveyid/{$surveyid}/type/separator",
			),
			array(
				'name'	=> '自定义内容',
				'url'	=> "/Admin/Subject/Add/surveyid/{$surveyid}/type/customize",
			),
		);
		$this->assign('tabs', $tabs);
	}
	
	public function Add()
	{
		$this->display('Subject/add.html');
	}
}